/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.open.api.core.repository.mapper;

import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import info.peigen.hotpot.component.open.api.core.repository.entity.OpenApiLogEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.beetl.sql.mapper.annotation.Sql;

import java.util.List;

/**
 * <b>(OpenApiLogMapper)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/1
 */
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
@Mapper
public interface OpenApiLogMapper extends AbstractBeetlSqlMapper<OpenApiLogEntity> {
    @Select("select * from open_api_log where partner_id=#{partnerId}")
    public List<OpenApiLogEntity> findByPartnerId(String partnerId);

    @Select("select * from open_api_log where api_code=#{apiCode}")
    public List<OpenApiLogEntity> findByApiCode(String apiCode);

    @Sql("select * from open_api_log where request_no = ?")
    public OpenApiLogEntity findByRequestNo(String requestNo);

    @Delete("delete from open_api_log where partner_id=#{partnerId}")
    public void deleteByPartnerId(String partnerId);

    @Delete("delete from open_api_log where request_no=#{requestNo}")
    public void deleteByRequestNo(String requestNo);
}